import { createRouter, createWebHistory } from 'vue-router';
import Home from '@/views/home/index.vue';

const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        component: Home,
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

// 添加路由守卫
router.beforeEach((to, from, next) => {
    if (to.path === from.path) {
        console.log('路由相等啦');
        return;
    } else {
        next();
    }
});

export default router;